package com.isoft.demo.service.impl;

import com.isoft.demo.common.ResData;
import com.isoft.demo.dao.IcomeDao;
import com.isoft.demo.entity.Icome;
import com.isoft.demo.service.IcomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @version 1.0
 * @ClassName:IcomeServiceImpl
 * @Description: TODO
 * @Author guowei
 * @Date:2021/7/15 10:22
 */
@Service
public class IcomeServiceImpl implements IcomeService {
    @Resource
    private IcomeDao dao;

    @Override
    public ResData list() {
        List<Icome>list = dao.list();
        ResData rd = new ResData();
        if(list != null){
            List m = new ArrayList();
            for(int i = 0;i<list.size();i++){
                m.add(list.get(i).getImoney());
            }
            List y = new ArrayList();
            for (int n = 0;n<list.size();n++){
                y.add(list.get(n).getMonth());
            }
            rd.setData(m);
            rd.setCategories(y);
        }
        return rd;
    }
}
